# 最低CMake版本要求
cmake_minimum_required(VERSION 3.15)

# 项目名称和版本
project(KVstorageBaseRaft)

# 设置C++标准（根据项目需求选择，建议C++20及以上）
set(CMAKE_CXX_STANDARD 20)

# 指定编译类型为Debug，支持gdb调试
set(CMAKE_BUILD_TYPE "Debug")

# 设置项目可执行文件输出路径
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# 设置项目库文件输出的路径
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

# 添加头文件搜索路径（-I），指定各模块的include目录
include_directories(${PROJECT_SOURCE_DIR}/src/common/include)
include_directories(${PROJECT_SOURCE_DIR}/src/fiber/include)
include_directories(${PROJECT_SOURCE_DIR}/src/rpc/include)
include_directories(${PROJECT_SOURCE_DIR}/src/raftCore/include)
include_directories(${PROJECT_SOURCE_DIR}/src/raftRpcPro/include)
include_directories(${PROJECT_SOURCE_DIR}/src/raftClerk/include)
include_directories(${PROJECT_SOURCE_DIR}/src/skipList/include)
include_directories(${PROJECT_SOURCE_DIR}/example)

# 设置项目库文件搜索路径 -L
link_directories(${PROJECT_SOURCE_DIR}/lib)

# 递归处理src目录（包含核心代码模块）
add_subdirectory(src)

# 递归处理example目录（包含示例程序）
add_subdirectory(example)